﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="TR_ScholarshipFund.aspx.cs"
    Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.TR_ScholarshipFund" %>

<%@ Register Src="../Controls/user.ascx" TagName="user" TagPrefix="uc1" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">        
            <script type="text/javascript">
                function onTextChange(sender) 
                {
                    if (sender.get_value() == "") 
                    {
                        sender.set_text("");
                    }
                }
                function openDetails(scholar_fund_seq)
                {
                    radopen("TR_ScholarshipFundsDtls.aspx?Sequence=" + scholar_fund_seq, "ProjectDtls");
                    return false;
                }                                
            </script>       
    </telerik:RadCodeBlock>

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel6">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel6" LoadingPanelID="RadAjaxLoadingPanel2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="ProjectDtls" runat="server" ShowContentDuringLoad="false"
                VisibleStatusbar="false" Title="-" Width="1050px" Height="600px" Modal="true"
                Behaviors="Close">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadWindowManager ID="RadWindowManager2" VisibleStatusbar="false" ReloadOnShow="true"
        runat="server" Skin="Vista">
        <Windows>
            <telerik:RadWindow 
                id="RadWindow1"
                runat="server"        
                showcontentduringload="false"
                VisibleStatusbar="false"
                AutoSize = "true"
                title="รายละเอียดทุนที่มอบ"     
                Modal="true"
                behaviors="Close">                 
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <asp:Panel ID="Panel6" runat="server" Width="1001px">
        <table width="1000" cellpadding="0" cellspacing="0">
            <tr>
                <td valign="top">
                    <!--<uc1:user ID="user1" runat="server" />-->
                </td>
                <td width="20">
                </td>
                
            </tr>
            <tr>
                <td colspan="3">
                    <div class="moduleDivSlim1000x450">
                    <div class="moduleDivBottom1000">
                    <table align="center" width="980px">
                    <tr>
                        <td align="left" class="tableHeader">
                            แหล่งทุนการศึกษา
                        </td>
                    </tr>
                    </table>
                <table width="980px" align="center">
                    <tr align="center">
                    <td align="center">
                    <table align="center" style="height:390px; width: 964px;">
                    <tr align="center">
                        <td align="center" Height="390px" Width="960px">
                        <asp:Panel ID="PanelGrid" 
                            runat="server" 
                            Height="390px" 
                            Width="960px"
                            ScrollBars="Auto" >
                         <telerik:RadGrid ID="RadGrid2" runat="server" AllowAutomaticDeletes="True" 
                            AllowFilteringByColumn="True" AllowMultiRowEdit="True" 
                            AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True" 
                            AutoGenerateColumns="False" EnableAJAX="True" EnableAJAXLoadingTemplate="True" 
                            GridLines="None" 
                            GroupingSettings-GroupSplitFormat="" Skin="Outlook"
                            OnItemCommand="RadGrid2_ItemCommand" 
                            Height="370px"
                            Width="945px"  >
  
                                    <MasterTableView 
                                        AllowMultiColumnSorting="True" 
                                        CellSpacing="-1" 
                                        ClientDataKeyNames="scholar_fund_seq" 
                                        CommandItemDisplay="Top" 
                                        DataKeyNames="scholar_fund_seq"                                         
                                        NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                        <CommandItemTemplate>
                                            <table width="100%">
                                                <tr>
                                                    <td align="left">
                                                        <asp:LinkButton ID="AddInstitute"
                                                                runat="server" 
                                                                CommandName="AddData"
                                                                Visible="true">
                                                                <img style="border:0px;vertical-align:middle;" alt=""
                                                                src="../Images/Buttons/AddRecord.gif" /> เพิ่มรายการใหม่
                                                               
                                                        </asp:LinkButton>  
                                                    </td>
                                                    <td align="right">
                                                    </td>
                                                </tr>
                                            </table>
                                        </CommandItemTemplate>                                                                           
                                        <Columns>
                                            <telerik:GridBoundColumn HeaderText="PK" UniqueName="scholar_fund_seq" DataField="scholar_fund_seq" Visible="false">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn UniqueName="scholar_type_seq" DataField="scholar_type_seq" Visible="false">
                                            </telerik:GridBoundColumn>
                                            <telerik:GridTemplateColumn  
                                                HeaderStyle-Width="20px"                                                             
                                                HeaderStyle-HorizontalAlign="Center"
                                                ShowFilterIcon="false"
                                                AllowFiltering="false">                                                        
                                                <ItemTemplate>
                                                        <asp:ImageButton 
                                                            ID="cmdEdit" 
                                                            runat="server" 
                                                            CommandName="DataEdit"
                                                            OnClientClick="javascript: return confirm('แก้ไขข้อมูลที่เลือก?');"
                                                            ImageUrl="../Images/Buttons/Edit.gif" 
                                                            ToolTip="แก้ไขรายการ" />
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                            </telerik:GridTemplateColumn> 
                                            <telerik:GridTemplateColumn  
                                                HeaderStyle-Width="20px"                                                             
                                                HeaderStyle-HorizontalAlign="Center" 
                                                ShowFilterIcon="false"
                                                AllowFiltering="false">
                                                <ItemTemplate>
                                                        <asp:ImageButton 
                                                            ID="cmdDelete" 
                                                            runat="server" 
                                                            CommandName="Delete"
                                                            OnClientClick="javascript: return confirm('ลบข้อมูลที่เลือก?');"
                                                            ImageUrl="../Images/Buttons/Delete.gif" 
                                                            ToolTip="ลบรายการ" />
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                            </telerik:GridTemplateColumn> 
                                                                                                
                                            <telerik:GridBoundColumn 
                                                DataField="scholar_fund_seq" 
                                                HeaderText="รหัส" 
                                                ShowFilterIcon="false"
                                                FilterControlWidth="100%" 
                                                CurrentFilterFunction="Contains" 
                                                AutoPostBackOnFilter="true"
                                                UniqueName="No"
                                                Visible="false">
                                                <HeaderStyle HorizontalAlign="Center" Width="150px" />
                                                <ItemStyle HorizontalAlign="Center" Width="150px"/>
                                            </telerik:GridBoundColumn>

                                             <telerik:GridTemplateColumn 
                                                AutoPostBackOnFilter="true" 
                                                CurrentFilterFunction="Contains" 
                                                DataField="scholar_fund_descr" 
                                                FilterControlWidth="100%" 
                                                HeaderText="แหล่งทุน" 
                                                ShowFilterIcon="false" 
                                                UniqueName="scholar_fund_descr">          
                                                <ItemTemplate>              
                                                    <asp:LinkButton ID="cmDetail" runat="server" 
                                                        Text='<%# Eval("scholar_fund_descr") %>' 
                                                        OnClientClick='<%# string.Format("return openDetails(\"{0}\");", Eval("scholar_fund_seq")) %>'>
                                                    </asp:LinkButton>
                                                </ItemTemplate>  
                                                <HeaderStyle HorizontalAlign="Center" />             
                                            </telerik:GridTemplateColumn>
                                            <%--<telerik:GridTemplateColumn 
                                                AutoPostBackOnFilter="true" 
                                                ShowFilterIcon="false" 
                                                CurrentFilterFunction="Contains"
                                                DataField="scholar_fund_descr" 
                                                FilterControlWidth="100%" 
                                                HeaderStyle-HorizontalAlign="Center"
                                                HeaderText="แหล่งทุน">
                                                <ItemTemplate>
                                                    <asp:LinkButton ID="targetControl" runat="server" Text='<%# Eval("scholar_fund_descr") %>'
                                                        OnClientClick='<%# string.Format("return openProjectDetails(\"{0}\");", Eval("Sequence")) %>'></asp:LinkButton>
                                                </ItemTemplate>
                                                <HeaderStyle HorizontalAlign="Center" />
                                            </telerik:GridTemplateColumn>--%>
                                            <telerik:GridBoundColumn 
                                                DataField="scholar_type_descr" 
                                                HeaderText="ประเภททุน" 
                                                ShowFilterIcon="false"
                                                FilterControlWidth="100%" 
                                                CurrentFilterFunction="Contains" 
                                                AutoPostBackOnFilter="true"
                                                UniqueName="scholar_type_descr">
                                                <HeaderStyle HorizontalAlign="Center"  />
                                                <ItemStyle HorizontalAlign="Left" />
                                            </telerik:GridBoundColumn>
                                        </Columns>
                                        <%-- <PagerStyle 
                                            AlwaysVisible="true" 
                                            FirstPageToolTip="กลับหน้าแรก" 
                                            LastPageToolTip="ไปหน้าสุดท้าย" 
                                            Mode="NumericPages" 
                                            NextPagesToolTip="หน้าถัดไป" 
                                            NextPageToolTip="หน้าถัดไป" 
                                            PrevPagesToolTip="ย้อนกลับ" 
                                            PrevPageToolTip="ย้อนกลับ" />--%>
                                    </MasterTableView>
                                    <ClientSettings AllowColumnHide="True" AllowColumnsReorder="True" EnableRowHoverStyle="True"
                                        ReorderColumnsOnClient="True">
                                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                                    </ClientSettings>
                                </telerik:RadGrid>
                            </asp:Panel>
                            <asp:Panel ID="PanelAddData" 
                                runat="server"
                                Height="380px"
                                Visible="false" 
                                width="956px" 
                                align="center">
                                    <ul class="formList">
                                         <li>
                                            <table width="980px" align="center" >
                                                <tr>
                                                    <td align="left" class="tableDetailHeader" style="width: 980px">
                                                        ข้อมูลแหล่งทุนการศึกษา
                                                    </td>
                                                </tr>
                                            </table>
                                        </li>
                                        <li>
                                            <table style="width: 980px">
                                            <tr>
                                                <td>
                                                    <telerik:RadTextBox ID="txtExpSeq" runat="server" Visible="false" Width="300px"/>
                                                </td>
                                            </tr>
                                            <tr>  
                                                <td align="right" style="width: 200px">
                                                    แหล่งทุน :
                                                </td>                                                 
                                                <td align="left">                                                    
                                                    <telerik:RadTextBox ID="txtExpDescr" runat="server" Width="300px" />
                                                    <asp:RequiredFieldValidator ID="vtxtExpDescr" runat="server" 
                                                        ControlToValidate="txtExpDescr" ErrorMessage="*">
                                                    </asp:RequiredFieldValidator>
                                                </td>
                                            </tr>
                                            <tr>  
                                                <td align="right" style="width: 200px">
                                                    ประเภททุนการศึกษา :
                                                </td>                                                 
                                                <td align="left">
                                                    <telerik:RadComboBox 
                                                        runat="server" 
                                                        ID="cbScholaType" 
                                                        AllowCustomText ="true" 
                                                        DataTextField="scholar_type_list" 
                                                        DataValueField="scholar_type_seq" 
                                                        Filter ="Contains"
                                                        AutoPostBack="true"
                                                        CausesValidation ="false"
                                                        OnClientTextChange = "onTextChange"
                                                        EmptyMessage = "... เลือกประเภททุน..."
                                                        Width="360px" 
                                                        ZIndex="8000" Height="200px" >
                                                    </telerik:RadComboBox>
                                                </td>
                                            </tr>
                                          
                                            </table>  
                                                                                    
                                            <table width="600px">
                                            <tr>
                                                <td align="left">                                        
                                                    <asp:Label ID="lblError" runat="server" ForeColor="Red" Font-Size="Small" Font-Bold="true" />
                                                </td>                                     
                                            </tr>
                                            </table>
                                        </li>
                                    </ul>                                                                           
                                  <table style="width: 646px">
                                    <tr>                                    
                                    <td align="right" style="width: 321px">
                                        <asp:Button ID="btnSave" onclick="btnSave_Click" runat="server" CssClass="button" Text="บันทึก" Width="80px" />   
                                        <asp:Button ID="btnUpdate" onclick="btnUpdate_Click" runat="server" CssClass="button" Visible="false" Text="แก้ไข" Width="80px" />                         
                                    </td>
                                    <td align="left">
                                        <asp:Button ID="btnCancel" OnClick="btnCancel_Click" runat="server" CssClass="button" Text="ยกเลิก" Width="80px" />
                                    </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </asp:Panel>
</asp:Content>
